/**
 * 存储localStorage
 * @param name
 * @param content
 */
export function setStore(name, content) {
  if (!name) return
  if (typeof content !== 'string') {
    content = JSON.stringify(content)
  }
  window.localStorage.setItem(name, content)
}
/**
 * 获取localStorage
 * @param name
 * @returns {string}
 */
export function getStore(name) {
  if (!name) return
  return window.localStorage.getItem(name)
}
/**
 * 删除localStorage
 * @param name
 */
export function removeStore(name) {
  if (!name) return
  window.localStorage.removeItem(name)
}


var cookie = {
  set: function (name, value, time) {
    document.cookie = name + '=' + value + '; max-age=' + time;
    return this;
  },
  remove: function (name) {
    return this.setCookie(name, '', -1);
  },
  get: function (name, callback) {
    var allCookieArr = document.cookie.split('; ');
    for (var i = 0; i < allCookieArr.length; i++) {
      var itemCookieArr = allCookieArr[i].split('=');
      if (itemCookieArr[0] === name) {
        return itemCookieArr[1]
      }
    }
    return undefined;
  }
}

